package server.business.service.Impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import server.business.mapper.BloodDiscardReviewMapper;
import server.business.pojo.BloodDiscardApply;
import server.business.pojo.BloodDiscardReview;
import server.business.service.BloodDiscardReviewService;

import java.util.Date;

/**
* @author Galaxy
* @description 针对表【blood_discard_review】的数据库操作Service实现
* @createDate 2022-11-08 12:46:23
*/
@Service("bloodDiscardReviewService")
public class BloodDiscardReviewServiceImpl extends ServiceImpl<BloodDiscardReviewMapper, BloodDiscardReview>
    implements BloodDiscardReviewService{

    @Autowired
    private BloodDiscardReviewMapper bloodDiscardReviewMapper;

    @Override
    public Boolean setisDeletedById(String DiscardId, Integer is_deleted) {
        LambdaUpdateWrapper<BloodDiscardReview> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(BloodDiscardReview::getBloodDiscardId, DiscardId);
        updateWrapper.set(BloodDiscardReview::getIsDeleted, is_deleted);
        int result = bloodDiscardReviewMapper.update(null, updateWrapper);
        System.out.println("result" + result);
        return true;

    }

    @Override
    public Boolean setreviewidbyDiscardId(String DiscardId, String reviewerid) {
        LambdaUpdateWrapper<BloodDiscardReview> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(BloodDiscardReview::getBloodDiscardId, DiscardId);
        updateWrapper.set(BloodDiscardReview::getReviewerId, reviewerid);
        int result = bloodDiscardReviewMapper.update(null, updateWrapper);
        System.out.println("result" + result);
        return true;
    }

    @Override
    public Boolean setauditdaybyDiscardId(String DiscardId, Date date) {
        LambdaUpdateWrapper<BloodDiscardReview> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(BloodDiscardReview::getBloodDiscardId, DiscardId);
        updateWrapper.set(BloodDiscardReview::getReviewTime, date);
        int result = bloodDiscardReviewMapper.update(null, updateWrapper);
        System.out.println("result" + result);
        return true;
    }

    @Override
    public Boolean setapplystatebyDiscardId(String DiscardId, String state) {
        LambdaUpdateWrapper<BloodDiscardReview> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(BloodDiscardReview::getBloodDiscardId, DiscardId);
        updateWrapper.set(BloodDiscardReview::getState, state);
        int result = bloodDiscardReviewMapper.update(null, updateWrapper);
        System.out.println("result" + result);
        return true;
    }

    @Override
    public Boolean setrejectreasonbyDiscardId(String DiscardId, String rejectreason) {
        LambdaUpdateWrapper<BloodDiscardReview> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(BloodDiscardReview::getBloodDiscardId, DiscardId);
        updateWrapper.set(BloodDiscardReview::getRejectReason, rejectreason);
        int result = bloodDiscardReviewMapper.update(null, updateWrapper);
        System.out.println("result" + result);
        return true;
    }
}




